package com.webc.framework.util;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author hejianglong
 * @date 2018/9/7.
 */
public class JsonUtil {
    public static <T> String toJSON(T obj) {
        String json = null;
        try {
            ObjectMapper mapper = new ObjectMapper();
            json = mapper.writeValueAsString(obj);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }
}
